<template>
  <div class="all">
    <el-table :data="list" :header-cell-style="{background:'#eef3f7'}">
      <el-table-column align="center" type="index" label="序号"></el-table-column>
      <el-table-column align="center" prop="roomId" label="房间Id"></el-table-column>
      <el-table-column align="center" label="房间类型">
        <template slot-scope="scope">
          <i v-if="scope.row.roomType=='voice'">语音房间</i>
          <i v-else-if="scope.row.roomType=='fullVideo'">视频直播</i>
          <i v-else>拍拍房间</i>
        </template>
      </el-table-column>
      <el-table-column align="center" prop="roomName" label="房间名称"></el-table-column>
      <el-table-column align="center" prop="roomNotice" label="房间公告"></el-table-column>
      <el-table-column align="center" prop="userName" label="主播"></el-table-column>
      <el-table-column align="center" prop="nickName" label="用户的昵称"></el-table-column>
      <el-table-column align="center" label="操作">
        <template slot-scope="scope">
          <el-button type="danger" size="mini" @click="shop=true,record.roomId=scope.row.roomId">强制下播</el-button>
        </template>
      </el-table-column>
    </el-table>
    <div class="Page">
          <el-pagination
          background
          hide-on-single-page
            @current-change="handleCurrentChange"
            :current-page="condition.pageIndex"
            :page-size="100"
            layout="total, prev, pager, next, jumper"
            :total="condition.quantity">
          </el-pagination>

    </div>
    <el-dialog width="20%" title="下播原因" :visible.sync="shop">
      <el-input type="textarea" resize="none" v-model="record.reason"></el-input>
      <div style="text-align: center;margin-top: 5px;">
           <el-button type="danger" @click="Downcast">下播</el-button>
      </div>

    </el-dialog>
  </div>
</template>


<script>
  import {living,Forceddowncast} from '@/utils/API'
     import Cookies from 'js-cookie'
  export default{
         inject:["reload"],
    data(){
      return{
        time1: [],
          condition:{
              quantity:0,
              pageIndex:1,
              pageSize:20,
          },
          admin:{
            adminName:Cookies.get('adminName'),
            token:Cookies.get('token')
          },
           list:[],
           shop:false,
           record:{
             roomId:'',
             reason:''
           }
           // operation:{
           //   particulars:'进入直播间'
           // },
           // url:{
           //    post:'admin/user/get',
           // }
        }
        },
    methods:{
       open() {
              this.$alert('暂无页面', '网页提示', {
                confirmButtonText: '确定',
              });
            },
      search(){
        this.condition.fromRegTime=this.time1[0]
        this.condition.toRegTime=this.time1[1]
        this.Postdata('admin/user/get',this.condition)
      },
       handleCurrentChange(val) {
      living(this.admin,this.condition).then(res=>{
        this.list=res.data.livingRooms
      })
      },
      Downcast(){
        var _this=this
        Forceddowncast(this.record,this.admin).then(res=>{
          if(res.code==0){
            this.$message.success('操作成功')
              _this.reload()
          }
        })
      }


},
mounted(){
living(this.admin,this.condition).then(res=>{
  this.list=res.data.livingRooms
  this.condition.quantity=res.data.total
})
//this.Postdata('admin/user/get',this.condition)
}
        }
</script>

<style lang="scss" scoped src = "../../css/users.css">

</style>
